﻿@page "/demo"
@inherits BasePage
@attribute [Menu(AppConstant.Demo, "首页", "home", 1)]

<PageTitle>Home</PageTitle>

<div class="kui-card" style="padding:10px">
    <KFullScreen>
        <h1 style="font-size:2rem;font-weight:bold">Hello, world!</h1>

        Welcome to your new app.

        <KPdfView @ref="pdf" Id="pdfViewer" Style="height:400px" Option="new { ForceIframe = true }" />

        @if (Context.HasButton(nameof(New)))
        {
            <Button>新增</Button>
        }
        @if (Context.HasButton(nameof(Edit)))
        {
            <Button>编辑</Button>
        }
        @if (Context.HasButton(nameof(TestItem)))
        {
            <Button>TestItem</Button>
        }
    </KFullScreen>
</div>

@code {
    private KPdfView pdf;

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        await base.OnAfterRenderAsync(firstRender);
        if (firstRender)
            await pdf?.ShowAsync("/Files/5_新版报关委托书.pdf");
    }

    [Action] public void New() { }
    [Action] public void Edit() { }
    [Action] public void TestItem() { }
}